package basic;


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int k=s.nextInt();
        int t=s.nextInt();
        int x1=s.nextInt();
        int y1=s.nextInt();
        int x2=s.nextInt();
        int y2=s.nextInt();
        int p1=0;
        int p2=0;
        for (int i=1;i<=n;i++){
            int temp2=0;
            int flag=0;
            int[][] temp=new int[t][2];
            for (int j=1;j<=t;j++){
                int a1=s.nextInt();
                int a2=s.nextInt();
                temp[j-1][0]=a1;
                temp[j-1][1]=a2;
            }
            for (int j=0;j<t;j++){
                if (x1<=temp[j][0]&&temp[j][0]<=x2&&y1<=temp[j][1]&&temp[j][1]<=y2){
                    p1++;
                    break;
                }
            }
            for (int j=0;j<=t-k;j++){
                int l=1;
                for (int ii=0;ii<k;ii++){
                    if (!(x1<=temp[j+ii][0]&&temp[j+ii][0]<=x2&&y1<=temp[j+ii][1]&&temp[j+ii][1]<=y2)) {
                        l = 0;
                        break;
                    }
                }
                if (l==1){
                    p2++;
                    break;
                }
            }
        }
        System.out.println(p1);
        System.out.println(p2);
    }
}
